package com.learn.motion

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.WindowCompat
import androidx.fragment.app.commitNow
import com.learn.motion.ui.demolist.DemoListFragment
import com.learn.motion.ui.EdgeToEdge

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        val toolbar = findViewById<Toolbar>(R.id.toolbar)
        setSupportActionBar(toolbar)

        // 沉浸式配置
        WindowCompat.setDecorFitsSystemWindows(window, false)
        EdgeToEdge.setUpAppBar(findViewById(R.id.appbar), toolbar)

        if (savedInstanceState == null) {
            supportFragmentManager.commitNow {
                replace(R.id.container, DemoListFragment())
            }
        }
    }
}